#include "dockwindows.h"
#include <QTextEdit>
#include <QDockWidget>

DockWindows::DockWindows(QWidget *parent)
    : QMainWindow(parent)
{
    setWindowTitle(tr("DockWindows"));
    QTextEdit *te = new QTextEdit(this);
    te->setText(tr("main window"));
    te->setAlignment(Qt::AlignCenter);
    setCentralWidget(te);
    //dock window 1
    QDockWidget *dock = new QDockWidget(tr("DockWindow1"),this);
    //removable
    dock->setFeatures(QDockWidget::DockWidgetMovable);
    dock->setAllowedAreas(Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
    QTextEdit *te1 = new QTextEdit();
    te1->setText(tr("window1,the dock widget can be moved between docks by the users"""));
    dock->setWidget(te1);
    addDockWidget(Qt::RightDockWidgetArea,dock);
    //dock window 2
    dock = new QDockWidget(tr("DockWindow2"),this);
    dock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable);
    QTextEdit *te2 = new QTextEdit();
    te2->setText(tr("wndow2,the dock widget can be detached from the main window,""and floated as an independent window,and can be closed"));
    dock->setWidget(te2);
    addDockWidget(Qt::RightDockWidgetArea,dock);
    //dock window 3
    dock = new QDockWidget(tr("DockWindow3"),this);
    dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
    QTextEdit *te3 = new QTextEdit();
    te3->setText(tr("window 3,the dock wodget can be closed,moved,andfloated"));
    dock->setWidget(te3);
    addDockWidget(Qt::RightDockWidgetArea,dock);

}

DockWindows::~DockWindows()
{
}

